import request from '@/router/axios';

export const fetchList = (query) => {
  return request({
    url: '/api/xmbz-goods/goods/page',
    method: 'get',
    params: query
  })
}
// //添加商品
// export function addGoods(data) {
//   return request({
//     url: 'http://dev.crm.xiongmaodangao.com/goods/add',
//     method: 'post',
//     data
//   })
// }
// //删除商品
// export function deleteGoods(id) {
//   return request({
//     url: 'http://dev.crm.xiongmaodangao.com/goods/delete',
//     method: 'DELETE',
//     params: { id }
//   })
// }

// // 更新商品
// export function updateGoods(data) {
//   return request({
//     url: 'http://dev.crm.xiongmaodangao.com/goods/update',
//     method: 'PUT',
//     data
//   })
// }
// 修改商品
// export function editGoods(id) {
//   return request({
//     url: 'http://dev.crm.xiongmaodangao.com/goods/detail',
//     method: 'get',
//     params: { id }
//   })
// }
// 分类

export const categoriesList = (data) => {
  return request({
    url: '/api/xmbz-goods/goods/categories',
    method: 'get',
    data
  })
}

// 配送员
export function deliveriesList(deptId) {
  return request({
    url: '/api/xmbz-order/orderDispatch/deliveries',
    method: 'get',
    params: { deptId }
  })
}
// 图片上传
// export function fileupload(data) {
//   return request({
//     url: 'http://dev.center.xiongmaodangao.com/api/api/xmbz-goods/file/upload',
//     method: 'post',
//     params: { data }
//   })
// }
// 生产列表

// export function orderList(query) {
//   return request({
//     url: 'http://dev.crm.xiongmaodangao.com/order/list',
//     method: 'get',
//     params: query
//   })
// }

// 订单详情
export function orderList(query) {
  return request({
    url: '/api/xmbz-order/order/listWithDetail',
    method: 'get',
    params: query
  })
}

// 订单详情
// export function orderList(query) {
//   return request({
//     url: '/api/xmbz-order/order/listWithDetail',
//     method: 'get',
//     params: query
//   })
// }

// 总仓列表接口
export function mainWarehouses(deptId) {
  return request({
    url: '/api/xmbz-order/warehouse/mainWarehouses',
    method: 'get',
    params: { deptId }
  })
}
// 分仓列表接口
export function barnchWarehouses(deptId) {
  return request({
    url: '/api/xmbz-order/order/getSeparateWarehouseList',
    method: 'get',
    params: { deptId }
  })
}

// 订单调度
export function orderDispatch(deptId) {
  return request({
    url: '/api/xmbz-order/order/dispatch',
    method: 'post',
    params: { deptId }
  })
}

export function orderDelivery(data) {
  return request({
    url: '/api/xmbz-order/order/delivery',
    method: 'post',
    data

  })
}

// export function orderDispatch(deptId) {
//   return request({
//     url: '/api/xmbz-order/order/dispatch',
//     method: 'PUT',
//     params: { deptId }
//   })
// }
export function deptdepts() {
  return request({
    url: '/api/xmbz-system/dept/depts',
    method: 'get',
  })
}
// http://dev.crm.xiongmaodangao.com/dept/depts?roleId=1

// 订单状态
// /order/status/list
export function orderStatus(query) {
  return request({
    url: '/api/xmbz-order/order/status/list',
    method: 'GET',
    params: { query }
  })
}
// 获取订单操作日志

export function operatelogs(orderId) {
  return request({
    url: '/api/xmbz-order/order/operate/logs',
    method: 'GET',
    params: { orderId }
  })
}

// 订单调度
export function dispatch(query) {
  return request({
    url: '/api/xmbz-order/order/dispatch',
    method: 'post',
    params: query
  })
}
// 获取订单操作日志
export function operate(orderId) {
  return request({
    url: '/api/xmbz-order/order/operate/logs',
    method: 'GET',
    params: { orderId }
  })
}
// 根据组织架构ids，查询所有仓库信息（前端传城市id）
export function getWarehousesByDeptIds(deptId) {
  return request({
    url: '/api/xmbz-order/warehouse/getWarehousesByDeptIds',
    method: 'GET',
    params: { deptId }
  })
}

// 获取订单短信
export function smsList(orderId) {
  return request({
    url: '/api/xmbz-order/order/sms/list',
    method: 'GET',
    params: { orderId }
  })
}
// 添加分仓
export function warehouseSave(data) {
  return request({
    url: '/api/xmbz-order/warehouse/save',
    method: 'post',
    data
  })
}
// 修改分仓
export function warehouseUpdate(data) {
  return request({
    url: '/api/xmbz-order/warehouse/update',
    method: 'post',
    data
  })
}
// 删除分仓
export function warehouseDelete(data) {
  return request({
    url: '/api/xmbz-order/warehouse/delete',
    method: 'post',
    data
  })
}
// 获取组织架构树

export function ordergetDeptTree(data) {
  return request({
    url: '/api/xmbz-order/order/getDeptTree',
    method: 'GET',
    data
  })
}


// url: '/api/xmbz-order/order/getProductionQueryPage',
// url: 'http://dev.crm.xiongmaodangao.com/order/getProductionQueryPage',
// 生产管理分页条件查询列表
export const getProductionQueryPage = (query) => {
  return request({
    url: '/api/xmbz-order/order/getProductionQueryPage',
    // url: 'http://192.168.2.11:8107/order/getProductionQueryPage',
    method: 'GET',
    params: query
  })
}

// 今日生产数量汇总
export const getProductionOrderSummary = (query) => {
  return request({
    url: '/api/xmbz-order/order/getProductionOrderSummary',
    // url: 'http://192.168.2.11:8107/order/getProductionOrderSummary',
    method: 'GET',
    params: query
  })
}

// 蛋糕生产状态列表
export const getCakeProductionStateList = (query) => {
  return request({
    url: '/api/xmbz-order/order/getCakeProductionStateList',
    method: 'GET',
    params: query
  })
}

// 开始生产
export const singleStartProduction = (query) => {
  return request({
    url: '/api/xmbz-order/order/singleStartProduction',
    method: 'POST',
    params: query
  })
}

// 批量生产
export const batchStartProduction = (data) => {
  return request({
    url: '/api/xmbz-order/order/batchStartProduction',
    method: 'post',
    data
  })
}

// 入库和批量入库
export const orderWarehousing = (query) => {
  return request({
    url: '/api/xmbz-order/order/orderWarehousing',
    // url: 'http://192.168.2.11:8107/order/orderWarehousing',
    method: 'POST',
    params: query
  })
}

// // 入库和批量入库
// export const orderWarehousingCopy = (data) => {
//   return request({
//     url: '/api/xmbz-order/order/orderWarehousing',
//     method: 'post',
//     data
//   })
// }

// 打印和批量打印
export const orderPrinting = (data) => {
  return request({
    url: '/api/xmbz-order/order/orderPrinting',
    // url: 'http://192.168.2.11:8107/order/orderPrinting',
    method: 'post',
    data
  })
}

// 获取打印信息
export const orderPrintingFrequency = (data) => {
  return request({
    url: '/api/xmbz-order/order/orderPrintingFrequency',
    // url: 'http://192.168.2.11:8107/order/orderPrintingFrequency',
    method: 'post',
    data
  })
}
// 获取入库记录
export const getOrderWarehousingLogList = (data) => {
  return request({
    url: '/api/xmbz-order/order/getOrderWarehousingLogList',
    // url: 'http://192.168.2.11:8107/order/getOrderWarehousingLogList',
    method: 'get',
    data
  })
}

// 新增入库记录
export const addOrderWarehousingLog = (query) => {
  return request({
    url: '/api/xmbz-order/order/addOrderWarehousingLog',
    // url: 'http://192.168.2.11:8107/order/addOrderWarehousingLog',
    method: 'post',
    params: query
  })
}

// 确认入库记录
export const confirmAbnormalLog = (data) => {
  return request({
    url: '/api/xmbz-order/order/confirmAbnormalLog',
    // url: 'http://192.168.2.11:8107/order/confirmAbnormalLog',
    method: 'post',
    data
  })
}

// 退订改期异常记录
export const getNotReadOrderNewsLog = (query) => {
  return request({
    url: '/api/xmbz-order/order/getNotReadOrderNewsLog',
    // url: 'http://192.168.2.11:8107/order/getNotReadOrderNewsLog',
    method: 'GET',
    params: query
  })
}

// 生产中的蛋糕流程列表
export const getProductionProcessList = (query) => {
  return request({
    url: '/api/xmbz-order/order/getProductionProcessList',
    method: 'GET',
    params: query
  })
}

// 生产部生产中退订流程选择
export const productionChoice = (query) => {
  return request({
    url: '/api/xmbz-order/order/productionChoice',
    // url: 'http://192.168.2.11:8107/order/productionChoice',
    method: 'post',
    params: query
  })
}

// 生产部生产中退款流程选择
export const refundChoice = (query) => {
  return request({
    url: '/api/xmbz-order/order/refundChoice',
    // url: 'http://192.168.2.11:8107/order/refundChoice',
    method: 'post',
    params: query
  })
}

// 关闭订单
export const closeOrder = (data) => {
  return request({
    url: '/api/xmbz-order/order/closeOrder',
    // url: 'http://192.168.2.11:8107/order/closeOrder',
    method: 'post',
    data
  })
}

// 接单关闭订单列表
export const getCloseOrderList = (query) => {
  return request({
    url: '/api/xmbz-order/order/getCloseOrderList',
    // url: 'http://192.168.2.11:8107/order/getCloseOrderList',
    method: 'get',
    params: query
  })
}

// 接单关闭订单列表
export const getUpCloseOrder = (data) => {
  return request({
    url: '/api/xmbz-order/order/getUpCloseOrder',
    // url: 'http://192.168.2.11:8107/order/getUpCloseOrder',
    method: 'POST',
    data
  })
}

// 根据物料商品名称模糊查询
export const getMaterielGoodsByName = (query) => {
  return request({
    url: '/api/xmbz-goods/goods/getMaterielGoodsByName',
    // url: 'http://192.168.2.11:8107/order/getMaterielGoodsByName',
    method: 'get',
    params: query
  })
}

// 搜索出物料商品,打印需要返回的信息
export const getMaterielGoodsPrintingInfo = (query) => {
  return request({
    url: '/api/xmbz-goods/goods/getMaterielGoodsPrintingInfo',
    // url: 'http://192.168.2.11:8107/order/getMaterielGoodsPrintingInfo',
    method: 'get',
    params: query
  })
}

// 确认继续生产并入库记录
export const confirmProductionToWarehousingLog = (query) => {
  return request({
    url: '/api/xmbz-order/order/confirmProductionToWarehousingLog',
    // url: 'http://192.168.2.11:8107/order/confirmProductionToWarehousingLog',
    method: 'GET',
    params: query
  })
}
